 GDIdb Help Index

Introduction

GDIdb Overview

How To ...

Get Going Quickly

Use ODBC

Use SQL

Register GDIdb

Commands

File menu

Edit menu

Actions menu

View menu

Settings menu

Help menu

For information on the GDIdb  Script Language click on Contents.


File menu commands

The File menu offers the following commands:

Exit	Exits GDIdb.


Edit menu commands

The Edit menu offers the following commands:

Script Wizard	Opens the Script Wizard Utility.
Edit Default Script	Opens the Default Script file for editing.
Open/Edit Script	Opens a file select dialog allowing the user to select a Script File for editing.
Edit HTML	Opens the HTML File Dialog.
Open/Edit Database	Opens (user defined) database


Actions menu commands

The Actions menu offers the following commands:

Publish	Publish your Database to the Web.
Run Default Script	Execute the script file defined settings.
Open/Run Script	Open a file select dialog allowing the user to choose a script for execution.
Upload to Web Server	FTP the files generated by executing a Script onto your Web Server.


View menu commands

The View menu offers the following commands:

Preview Web Site	Opens the top-level HTML document in your Web Browser.
View Scripter List file	Opens the Scripter output listing with your text editor.
View System Event Log	Opens the Event Log dialog.


Settings menu commands

The Settings menu offers the following commands:

Clear Status Error Flag	Resets the Error Flag in the program status bar.
Enable Auto-Publish	Enable Publishing of your Database to a pre-defined schedule.
Hide Window on startup	Start GDIdb with the program window initially hidden.
Show Window on Error	Make the program window visible on any publishing errors. (if hidden)
Generate System Event log	Keep a permanent log of all system events.
Generate Scripter List file	Generate a file showing the Scripter output.
System Configuration	Open the System Configuration dialog.


Help menu commands

The Help menu offers the following commands, which provide you with assistance in operating GDIdb:

Help Topics	Offers you an index to topics on which you can get help.
About	Displays program  version and registration details.


File Exit command
Exit command (File menu)

Exit will terminate execution of GDIdb.

Note: this is the only way the program can be shut down, all other program close functions merely hide the GDIdb window. Once hidden, the window may be re-enabled by double clicking on the GDIdb icon in the status area of the task bar.


Edit/Script Wizard
Script Wizard (Edit menu)

GDIdb creates HTML documents by executing a script file . Although you can write script files from scratch using a text editor, Script Wizard provides a simple way of creating a script without the need to learn the GDIdb script language.

After running script wizard, add HTML to the script file by selecting Edit Script File from the Edit menu.


Edit/Edit Script File
Edit Default Script (Edit menu)

GDIdb creates HTML documents by executing a script file. Selecting Edit Default script file from the Edit  menu opens the default script file for editing. (The default script file is defined under System Configuration/Publish Actions under the Settings menu, and is the Script file executed on publish and auto-publish commands.)

The text editor used for this operation is defined in System Configuration/Helper Applications under the Settings menu.


Edit/Open-Edit Script File
Open/Edit Script (Edit menu)

GDIdb creates HTML documents by executing a script file. Selecting Open/Edit script file from the Edit  menu will open a file dialog allowing you to select a Script file for editing.

The text editor used for this operation is defined in System Configuration/Helper Applications under the settings menu.


Edit/Open-Edit Database
Open/Edit Database (Edit menu)

Use this menu command as a shortcut for executing your database software. You need to enter the path to your database program in System Configuration/Helper Applications under the Settings menu.

Example:

The following command line opens the demo database (supplied with GDIdb) using Microsoft Access on the author's computer.

C:\MSOffice\Access\Msaccess.exe c:\progra~1\GDIdb\workweb.mdb


Actions/Publish
Publish (Actions menu)

Once GDIdb has been correctly configured, Publish is  the only action needed to publish your ODBC  compatible data source on the WWW. The sequence of events triggered by publish is defined under System Configuration under the settings menu. The possible actions are:

1. The default script file is run

2. A dial-up Internet connection is made

3. The HTML files generated by the Scripter are copied to the web server

4. A user-defined DOS or Windows Command is executed

Note: The only files copied to the web server by the publish command are the HTML files generated by GDIdb. Any other files in the HTML directory (such as .GIF or .JPG files) are not copied. These files should be transferred to the web server manually.


Actions/Run Default Script
Run Default Script (Actions menu)

GDIdb creates HTML documents by running a script file After selecting this option from the menu, GDIdb will have generated HTML files from the contents of your datasource. The default script file is the script file executed when you run the Publish or Auto Publish commands and is defined in System Configuration/Publish Actions under the Settings menu.

You can preview the way your web site will look by selecting Preview Web Site from the View menu, or copy the HTML files to your Web server by selecting Upload to Web Server from the Actions menu.

Note: The default script is automatically run if you select Publish


Actions/Open/Run Script
Open/Run Script (Actions menu)

GDIdb creates HTML documents by running a script file. After selecting this option from the menu, GDIdb will present you with a dialogue allowing you to select a script file for execution.

After running this script, GDIdb will have generated HTML files from the contents of your datasource, you can preview the way your web site will look by selecting Preview Web Site from the View menu, or copy the HTML files to your Web server by selecting Upload to Web Server from the Actions menu.

Note: The default script is automatically run if you select Publish


Actions/Upload to Web Server
Upload to Web Server (Actions menu)

After your HTML documents have been generated by running a script file , they need to be copied to your Web Server. Selecting upload to Web Server triggers the following series of events:

1. If enabled under Settings/Publish Actions, a dial-up Internet connection is made

2. The HTML files generated by the Scripter are copied to the web server

3. The dial-up connection is disconnected

Notes:

1. The HTML documents are automatically moved to the Web Server if you select Publish.

2. The only files copied to the web server by the publish command are the HTML files generated by GDIdb. Any other files in the HTML directory (such as .GIF or .JPG files) are not copied. These files should be transferred to the web server manually.


View/Preview Web Site
Preview Web Site (View menu)

After running a script file you can preview the HTML generated by GDIdb before copying the files to your web server. The web browser used in this operation is defined in System Configuration/Helper Applications under the Settings menu.

Note: By default, the HTML generated by GDIdb is stored in a sub-directory of the program directory called html. Remember to put any GIF or jpg files that your site uses in this directory, otherwise the preview of the web site will be incomplete.


View/View Scripter List file
View Scripter List File (View menu)

GDIdb will generate a Scripter list file if Generate Scripter List file is enabled under the settings menu. This file shows the output of the Scripter, if the system reports that there are errors in your script file you can view the list file to see exactly where your script went wrong.

Notes:

1. This control will be disabled if Generate Scripter List file under the Settings menu is not enabled.

2. As errors terminate execution of the script, the error will always be at the end of the file.

The text editor used for this operation is defined in System Configuration/Helper Applications under the Settings menu.The list file is stored in the program directory in a file called “listfile.txt”.


View/ View System Log
View System Event Log (View menu)

GDIdb will generate a system log file if Generate system Log is enabled under the Settings menu.  GDIdb will write time and date stamped information to this file indicating the results of each of the following operations:

1. Publish

2. Run default Script

3. Open/Run Script

4. Upload to Web Server

5. Auto Publish

The system event log dialog includes filters allowing you to view entries with errors only, or recent (last 5 days) entries only. The log is stored in the program directory in a file called “logfile.txt”, if you click on the reset log button GDIdb will delete the contents of this file.

Notes:

1. This control will be disabled if Generate System Event Log under the Settings menu is not enabled.


View/ View FTP File List
Edit HTML (Edit menu)

After a script file  has been run, GDIdb will have created a list of files to be transferred to your Web Server. You may view/edit the files before transferring them to your Web Server by selecting Edit HTML under the Edit menu.

To edit a file, double-click on a filename (or select it and press the edit button) to open the HTML file in your text editor.


Settings/ Clear Status Error Flag
Clear Status Error Flag (Settings menu)

Any errors encountered by GDIdb whilst Publishing, executing script files or moving files to your web server will set the error status flag in the status bar. (When set, an exclamation mark will appear in the right hand corner of the status bar)

The error status flag is provided as a fast means of checking for publishing errors without having to examine the system log, and will remain set until manually reset.

Select Clear Status Error Flag under the Settings menu to reset this indicator.


Settings/Enable Auto Publish
Enable Auto-Publish (Settings menu)

Select enable auto-publish under the Settings menu to automatically keep the contents of your web site up-to-date. Before selecting this option, ensure that you have defined a publish schedule under System configuration/Publish Schedule under the Settings menu. It is also a good idea to check that the Dialup and web server settings are correct first by manually executing publish and checking for error messages.

The sequence of events triggered by Auto-publish is defined in System Configuration/Publish Actions under the Settings menu. The possible actions are:

1. The default script file is run

2. A dial-up Internet connection is made

3. The HTML files generated by the Scripter are copied to the web server

4. A user-defined DOS or Windows Command is executed

If GDIdb encounters problems whilst Auto Publishing, the error flag in the right hand side of the program status bar will be set. View the system Log by selecting View System Event Log from the View menu for details of the problem.

If you are using GDIdb in Auto Publish mode, you can configure the software to run unobtrusively in the background. Place a shortcut to GDIdb in your startup folder (see Windows Help), and enable Hide Window on startup under the Settings menu. GDIdb will now start invisibly whenever you start up Windows, double-click on the GDIdb icon in the status area of the Windows taskbar to bring up the GDIdb dialog should you wish to alter any settings.

Select Show Window on Error under the settings menu, and the program window will automatically appear if GDIdb encounters problems whilst publishing your data.

Note: The only files copied to the web server by the auto  publish command are the HTML files generated by GDIdb. Any other files in the HTML directory (such as .GIF or .JPG files) are not copied. These files should be transferred to the web server manually.


Settings/Hide Window on startup
Hide Window on startup (Settings menu)

Once GDIdb is correctly configured you will probably want to run it as a background service. If you have configured GDIdb to automatically start up each time your computer is switched on (by placing a shortcut to GDIdb in your startup folder) select this option and GDIdb will startup and run invisibly. To make the GDIdb dialog visible, double click on the GDIdb ‘G’ icon in the status area of the taskbar.


Settings/Show Window on error
Show Window on Error (Settings menu)

If you are running GDIdb with the program window hidden, you may want to be informed of any publishing errors that occur. Selecting Show Window on error will cause the program window to appear if GDIdb encounters problems.


Settings/Generate System Log
Generate System Event Log (Settings menu)

GDIdb will generate a system log file if this option is enabled. GDIdb will write time and date stamped information to this file indicating the results of each of the following operations:

1. Publish

2. Run default Script

3. Open/Run Script

4. Upload to Web Server

5. Auto Publish

If you are using the Auto Publish feature, we recommend that you enable this feature, as it may otherwise be difficult to troubleshoot errors. View the log contents by selecting View System Event Log from the View  menu.


Settings/Generate Scripter List file
Generate Scripter List file (Settings menu)

GDIdb will create a list file every time a script file is run if this option is selected. If your script is producing error messages, enable this option, re-run the script, and then view the Scripter list file by selecting View Scripter List file from the View menu. It should be possible to see where in the script the error was encountered, the error will always be at the end of the list file since any errors will terminate execution of the script file.

Note: For speed of execution reasons, GDIdb creates the list file in memory. If your script produces very large list files, you will need to ensure that your computer has sufficient memory.


Settings/System Configuration
System Configuration (Settings menu)

GDIdb stores the following configuration information in the system configuration dialog:

Publish Schedule

Publish Actions

Web Server settings

FTP Settings

Helper Applications

System Settings


Settings/System Configuration/Dialup
System Configuration/Dialup Details (Settings menu)

If you are using a dial-up Internet connection to copy your HTML files to your Web Server, you need to fill in your Internet account details here. You will also need to tick the “Establish Dial Up Internet connection” check box on the Publish Actions dialog.

Phone Book entry:

This is the name given to the Windows 95/N.T. Dialup connection that you will be using to connect to the Internet. Select the connection you require from the drop-down list  box, if the list box is empty, you will need to create a phone book entry before continuing. (Click on "My Computer/ Dial Up Networking")

Username:

This is the Username used to log on to your Internet connection. If you are not sure what it is, check the documentation provided by your Internet Service Provider.

Password:

This is the password used to log on to your Internet connection. If you are not sure what it is, check the documentation provided by your Internet Service Provider.

Number of times to attempt connection:

If your Internet service provider is engaged or there is some other reason why the dial-up connection does not succeed, this is the number of times GDIdb will attempt to connect before canceling the operation. We recommend a value of 3.


Settings/System Configuration/Web Server
System Configuration/Web Server (Settings menu)

If Transfer HTML files to Web Server is enabled on the Publish Actions dialog, GDIdb must know the following information before it can successfully execute Publish, Auto Publish and Upload Files to Web Server commands.

Host Name

This is the domain name you use when uploading files to your web server. (e.g. www.yourcompanyname.com) Sometimes the name for FTP uploads is different to the name in your web URL. If you are not sure what it is, check the documentation provided by your Web Server provider.

Port

This is the port number on which your Web Server accepts FTP connections. The default value is 21.

Username

This is the username used when logging on to your WWW server to upload files by FTP. If you are not sure what it is, check the documentation provided by your Web Server provider.

Password

This is the password used to log on to your WWW server. If you are not sure what it is, check the documentation provided by your Web Server provider.

Root HTML Directory

This is the root directory on your Web Server where your HTML documents will be stored. After logging on to the Web Server, GDIdb will change to this directory before starting FTP upload of the files. Leave this box blank if the files are to go in the root directory of the web server, otherwise enter the pathname you require. e.g. homepages/fred


Settings/System Configuration/Publish Schedule
System Configuration/Publish Schedule (Settings menu)

GDIdb can automatically update your Web Site from the contents of your datasource at pre-determined intervals. To use this feature, Settings/Auto-Publish must be enabled.

Check the Settings/System Configuration/Publish Actions dialog to make certain that the actions you require occur on the Auto-Publish times/days.

Auto-Publish Times

Enter a list of times here when you require GDIdb to publish your datasource data. The time must be entered using the 24 hour clock in the format: HH:MM, and be between the values 0:00 and 23:59 e.g.: 15:30

Note: Connection times are only accurate to within 1 minute.

Auto-Publish Days

Tick the days when you want Publishing to occur.

Note:

Changes made to the Publish Schedule will sometimes not take effect until the following day. If it is important that they take effect immediately, shut down and restart GDIdb. Any auto-publish actions that are pending when GDIdb is run will occur within a minute of the program being started up.


Settings/System Configuration/Helper Applications
System Configuration/Helper Applications (Settings menu)

Editor/Web Browser:

GDIdb uses external software to edit scripts, view log files and preview HTML. You need to enter the full pathname for your preferred text editor and web browser in the text boxes provided if you wish to change them from the defaults.

(e.g.: c:\program files\plus!\microsoft internet\iexplore.exe)

The default text file helper is Microsoft Notepad, the default web browser is initialized to the default Windows web browser defined on your system.

Note: If you delete the text contained in the web browser edit box and restart GDIdb, the web browser text box will be initialized to the path of the current Windows default web browser.

Database Software:

If you select Open/Edit  Database from the Edit menu, this command line will be executed. Enter (or browse for) the path to your database software, followed by the path to the database file you wish to open.

 Example:

The following command line opens the demo database (supplied with GDIdb) using Microsoft Access on the author's computer.

C:\MSOffice\Access\Msaccess.exe c:\progra~1\GDIdb\workweb.mdb


Settings/System Configuration/Publish Actions
System Configuration/Publish Actions (Settings menu)

When GDIdb executes either the Publish or Auto-Publish commands, a set sequence of events is triggered. Tick the check boxes of all the actions that you would like to occur on these commands. The sequence of execution of these events is from top to bottom of the dialog.

1. Run Script File- You will almost certainly want a script file to be run on Publish. Enter the name of the script file you wish to run in the edit box.

2. Establish dial-up Internet connection- If you wish GDIdb to FTP the HTML files to your web server over a dial-up or ISDN connection, you will need to check this box. Make certain that you have included all required information on the System Configuration/Dialup details dialog under the Settings menu.

3. Transfer HTML files to Web Server- If you check this box, GDIdb will establish a FTP connection with your web server, and transfer all of the HTML files generated by the last run script file. Make certain that you have all of your web server details entered on the System Configuration/Web Server dialog under the settings menu.

4. If you would like GDIdb to execute a DOS/Windows command after all of the above actions are complete, check the box and enter the command in the edit box.

Note: The normal configuration is to have the top three boxes checked. The bottom check box allows a DOS/Windows command or batch file to be to be run,  this is useful if you simply want to copy the HTML files to another directory, either on your computer or to a different computer  over your LAN.


Settings/System Configuration/FTP Proxy
System Configuration/FTP Settings (Settings menu)

FTP Proxy

If your access to the Internet is via a proxy server, tick the check box and fill in the following information:

1. Host Name- this is the domain name or IP address of your proxy server.

2. Port- this is the port number on which your proxy server accepts FTP connections. The default is 21.

File Management

GDIdb will normally overwrite existing files of the same name, although if you check this box GDIdb will delete any files moved to the Web Server on the previous publish which were not overwritten by the current FTP upload.

Note:

GDIdb will only work correctly with a TIS proxy. CERN type proxies are not supported.


Settings/System Configuration/System Settings
System Configuration/System Settings (Settings menu)

Root HTML Directory

The default html directory (where HTML files generated by GDIdb are stored) is called "html", and can be found within the program directory. If you would like to change the html directory, enter the path (either relative to the GDIdb program directory, or an absolute path) in the Root HTML directory edit box. e.g. a path of c:\mydir will cause all html files to be stored in mydir located in the root directory of the c drive.

Delete old HTML files first

If this box is checked, GDIdb will delete all HTML files (from the local root HTML directory) generated by the last-run script whenever a script file is executed.  Check the box to prevent a build-up of unused HTML files in your local HTML directory, leave it unchecked if you wish to keep HTML generated by the last-run script.

Process Priority

You may select the process priority you wish to give GDIdb.  A high priority will allow GDIdb to run faster, if you wish to run GDIdb whilst using the computer for other tasks selecting a lower priority will prevent GDIdb from slowing your other software down.


Toolbar

The toolbar is displayed across the top of the application window, below the menu bar.  The toolbar provides quick mouse access to many tools used in GDIdb,

Click	To

Publish datasource to Web.

Execute the default Script file.

Open the default Script file for editing.

Open the top-level HTML document in your web browser.

View the Scripter list output file.

Open the system event log dialog.

Activate click-on help.


Status Bar

The status bar is displayed at the bottom of the GDIdb window.

The left area of the status bar describes actions of menu items as you use the arrow keys to navigate through menus.  This area similarly shows messages that describe the actions of toolbar buttons as you depress them, before releasing them.  If after viewing the description of the toolbar button command you wish not to execute the command, then release the mouse button while the pointer is off the toolbar button.

The right areas of the status bar indicate the following:

Indicator	Description

IDLE/BUSY	Indicates whether the program is currently processing an action.

!	A '!' in the Status bar error indicator indicates that  there has been an operational error since the flag was last cleared. The flag may be cleared by selecting Clear Status Error Flag from the Settings menu.


Index command (Help menu)

Use this command to display the opening screen of Help.  From the opening screen, you can jump to step-by-step instructions for using GDIdb and various types of reference information.

Once you open Help, you can click the Contents button whenever you want to return to the opening screen.


Using Help command (Help menu)

Use this command for instructions about using Help.


About command (Help menu)

Use this command to display the version number and registration details of your copy of GDIdb.


Help Using Help Command
Context Help command

Use the Context Help command to obtain help on some portion of GDIdb.  When you choose the Toolbar's Context Help button, the mouse pointer will change to an arrow and question mark.  Then click somewhere in the GDIdb window, such as another Toolbar button.  The Help topic will be shown for the item you clicked.

Shortcut

Keys:	SHIFT+F1


Title Bar

The title bar is located along the top of a window.  It contains the name of the application.

To move the window, drag the title bar.  Note: You can also move dialog boxes by dragging their title bars.


Move command (Control menu)

Use this command to display a four-headed arrow so you can move the active window or dialog box with the arrow keys.

Shortcut

Keys:	CTRL+F7


Close command (Control menu)

Use this command to hide the program window.

Double-clicking a Control-menu box is the same as choosing the Close command.

Shortcuts

Keys: 	ALT+F4


Restore command (Control menu)

Use this command to return the active window to its size and position before you chose the Maximize or Minimize command.


Switch to command (application Control menu)

Use this command to display a list of all open applications.  Use this "Task List" to switch to or close an application on the list.

Shortcut

Keys:	CTRL+ESC

Dialog Box Options

When you choose the Switch To command, you will be presented with a dialog box with the following options:

Task List

Select the application you want to switch to or close.

Switch To

Makes the selected application active.

End Task

Closes the selected application.

Cancel

Closes the Task List box.

Cascade

Arranges open applications so they overlap and you can see each title bar.  This option does not affect applications reduced to icons.

Tile

Arranges open applications into windows that do not overlap.  This option does not affect applications reduced to icons.

Arrange Icons

Arranges the icons of all minimized applications across the bottom of the screen.


No Help Available

No help is available for this area of the window.


No Help Available

No help is available for this message box.


GDIdb

GDIdb software has been designed to allow a database/spreadsheet driven web site to be created using a dial-up or ISDN Internet connection. This is useful in either of the following situations:

1. You have an existing database whose contents you'd like to publish on your Web site.

2. You want to design a web site whose contents and structure can be easily updated by unskilled personnel. (By entering data into a purpose-designed Web Site database)

GDIdb works by executing a script file that describes how to construct a Web site from the datasource, the output of this process is a series of HTML documents that represent both the structure of the database and the information within it. A Script Wizard is included with GDIdb, this utility provides an easy way to create the script you need without having to learn the GDIdb script language, although by editing the script file manually you have total control over the appearance and structure of the HTML generated by GDIdb. The data source itself must be available (as an ODBC compatible database or spreadsheet file) to the computer on which GDIdb is running.

After converting the datasource content to HTML, GDIdb can establish a dial-up connection to your Internet service provider, and use this connection to copy the HTML documents to your Web Server.

Each stage of the operation, from editing and running a script file to uploading the HTML files to the Web server can be done manually, although the Publish function will complete the whole process. An auto-publish facility is included, allowing a schedule of unattended publishing to be created. Clicking the publish button on the GDIdb program toolbar is all that is required to publish your database/spreadsheet to the WWW, allowing manual updating of the web site to be easily performed.


Script Language Overview

GDIdb generates HTML documents from the data in your datasource by executing a script file. This file forms a template for the design of your web site, and contains HTML along with embedded functions to control how the datasource information is merged with the HTML. In order to write your own scripts you will need to learn how to use the Script Language functions, and also the datasource variables which allow you to access data from your datasource in a GDIdb script.

Seasoned programmers may find GDIdb script language itself is somewhat unusual, (see the description of blocks below) the reason behind this departure from convention is that the language was designed to allow an existing HTML file to be easily converted into a GDIdb script file.

Rather than start writing your own scripts from scratch, we suggest that you run ScriptWiz to generate a basic script file, which you can build on. It is far easier to start with something that is already working and modify it until it is what you require. If you want to write your own script from scratch, learn about datasource variables and the following basic functions first:  &datasource, &html and  &getdata. 99% of the time, these functions are all that you will need to write your script- study the example script  “foodstore.scp” (in the program directory) which uses just these 3 functions to include a spreadsheet table in a web page.

Note: If you wish to cancel execution of a running script, press the esc key.

Conventions:

Special characters:

The characters & \ ?  #  ( ) } and {  have special meanings in script files. To include one of these characters in your HTML, insert a \ character before the character, e.g. if you want a ? character to appear in your HTML you must put the sequence \? In your script file. To insert the \ character itself in your HTML, use the sequence \\ in your script file.

Comment text:

If a # character is found in the script file, the script processor ignores all characters until the end of the line. Use this character to mark the start of a comment line.

Function names:

All Scripter function names start with an ampersand & character.

Function arguments:

All Scripter function arguments (text passed to the function by placing it between  opening and closing brackets( ) following the function name) can consist of text or arithmetic/Boolean expressions. If the argument type (text or numeric) is unknown, arguments enclosed within double-quotes are treated as a text string value, otherwise GDIdb attempts to evaluate the argument as a arithmetic/Boolean expression.

Function return values:

GDIdb Scripter functions do not return a value. Functions that generate data require a variable to be passed as an argument- the data will be assigned to this variable.

Blocks:

Most Scripter functions operate on blocks. A block is  defined as the text contained within a set of opening and closing curly braces. { } placed immediately after the function. The text contained within the curly braces may consist of HTML or further GDIdb functions. Like many programming languages, GDIdb script language uses { } enclosed blocks to define scope of execution, e.g. a block following an if statement will only be executed if the argument to the if statement evaluates true. GDIdb extends the use of blocks to include database variable scope and html output file scope.

Variables:

All Scripter variable names (datasource, system and user-defined) start and end with the ? character. At any point in a script file where GDIdb encounters a variable, (except within function arguments) GDIdb will write the contents of that variable to the current HTML file. This allows variables and HTML to be freely mixed.

Datasource variable names are taken directly from the column names of the dataset returned by a previous &sql or &getdata function.

Scripter system variables override any datasource variables of the same name.


&html(filename)
&html(“filename”)

The &html function allows the script file to write HTML to the file path which has been passed as an argument to the function. The HTML to be written to the file must be enclosed in curly braces immediately after the function, this HTML may contain further GDIdb functions. The argument passed to &html must be a text string expression.

The file path can consist of a filename and directory path, if you are writing HTML to sub-directories you must ensure that the sub-directories exist, both on your web server and in your local HTML directory. The file path given must be relative  to the root HTML directory. The local root HTML directory and the Web Server root HTML directory can both be configured in the system configuration dialog. (under the Settings menu)

GDIdb keeps a list of filenames created by the &datawrite and &html functions, all files on this list are transferred to the web server on publish and Upload to Web Server commands. You may view this list, and edit the HTML files themselves by selecting Edit HTML (under the Edit menu)

Notes:

1. An &html(“newfilename” )  function embedded in this HTML will direct output to newfilename  for the scope of it’s curly braces, output thereafter will revert to the previous file.

2. You cannot use a file path that attempts to create a file in a directory above the HTML root directory, or a file path that is not relative to the local html root directory.  E.g. both of the following file paths are illegal: "C:\html\index.html" and "/mydir/index.html"

3. Directories in the file path may be separated with forward slashes or backward slashes- remember that when using backward slashes in a string expression that you will need two backward slashes: e.g. "mydir\\index.html"

Example:

# The following script will produce 2 html files, and demonstrates

# the use of nested &html functions.

#

# Note: for this script to work, directory "mydir" must exist within the

# local HTML directory, and within the Web Server root directory.

&html(“mydir/htmlfile1.html”)

{

<HTML>

<BODY>

<H1>This HTML will be written to a file called htmlfile1.html</H1><BR>

<A HREF=”htmlfile2.html”>link to htmlfile2</A><BR>

# direct HTML output to “htmlfile2.html”

&html(“mydir/htmlfile2.html”)

{

<HTML>

<H1>This HTML will be written to HTML file “htmlfile2.html”</H1>

</HTML>

}

<H1>And this html will be written to file “htmlfile1.html” again</H1>

</BODY>

</HTML>

}


&datasource(ODBC datasource Name)
&datasource(“ODBC connect string”)

The &datasource function is used to declare the ODBC connect string that will be used for all following  datasource operations involving the &sql and &getdata functions, and tells GDIdb how to make a connection to your database. The function may be called at any time to change  the ODBC connect string used in all subsequent operations. If the &datasource function is not called before a &sql or &getdata  function is used, a dialogue will open when the script file is run allowing the user to select a data source. The argument  to the function must be a text string expression

The connect string contains information such as:

An ODBC Data Source Name (DSN) OR  the path to a database/spreadsheet file, the name of the ODBC driver to use, and login and password information. (locked databases only)

Each item of information in the connection string is must be separated with a semicolon. Remember that the \ character is a special character in GDIdb script language, to include a single \ character in your connect string, you must insert two \\ characters.

Allowed keywords are:

ODBC DSN	DSN=

ODBC Driver	Driver=

Logon I.D.	UID=

Password	PWD=

File name	DBQ=

Note that when specifying the ODBC driver, the driver name must be enclosed with curly braces { }

GDIdb will try to connect  to your database with the information you supply, but if the information supplied in the connect string is insufficient to make the connection, a dialog will open when the script is run asking for the missing information.

See ODBC Help for more information on connect strings.

Example:

# Use “globaldata” ODBC DSN.

&datasource(“DSN=globaldata”)

# Connect directly to a unlocked Microsoft Access file (the example provided with GDIdb)

&datasource(“Driver={Microsoft Access Driver (*.mdb)};DBQ=c:\\program files\\gdidb\\workweb.mdb”)

# Connect directly to a Microsoft Access file as user “Admin”, Password “secret”

&datasource(“Driver={Microsoft Access Driver (*.mdb)};UID=admin;PWD=secret;DBQ=c:\\program files\\gdidb\\workweb.mdb”)

# Connect directly to a Microsoft Excel  file

&datasource("Driver={Microsoft Excel Driver (*.xls)};DBQ=c:\\program files\\gdidb\\foodstore.xls")


&sql(SQL Statement)
&sql(“SQL statement”)

The &sql function performs a SQL query on the datasource named by a preceding &datasource function. The function returns a set of data, which may be accessed and merged with your HTML by using datasource variables The argument  to the function must be a text string expression

Notes:

1. The datasource data made available by &sql is only available for the scope of the opening & closing curly braces { }  following the function.

2. If the text between the opening & closing curly braces contains another &sql function, the previous &sql function’s data will be masked. Check out the section on datasource variables to find out how to access it.

3. This function is depreciated by the newer &getdata function, although it is still useful if you wish to extract a dataset without actually looping through all of the records.

Example:

# Use globaldata ODBC DSN

&datasource(“DSN=globaldata”)

# Get all data from table “categories” from globaldata ODBC connection

&sql (“SELECT * FROM Categories")

{

# Print out the contents of the first row of data from the categoryname column

# of the dataset

<H3>Category=?categoryname?</H3>

}


&nextrow

The &nextrow function makes the next row of datasource data available. This function must be preceded by a call to &sql to generate a dataset. Care must be taken not to call &nextrow when there are no more rows of data available in the dataset, as it will cause an error.

Example:

# Get all data from table “categories” from globaldata ODBC DSN

&datasource(“DSN=globaldata”)

&sql (“SELECT * FROM Categories")

{

# Print out the contents of the first row of data from the

# categoryname column of the dataset

<H3>Category=?categoryname?</H3>

&nextrow

# Print out the contents of the second row of data from the

# categoryname column of the dataset

<H3>Category=?categoryname?</H3>

}


&getdata("SQL Statement",n)
&getdata(“SQL statement”,n)

The &getdata function does the following:

1. An SQL query is made on the datasource (named in a previous &datasource function) using the text string expression supplied as an argument to the &getdata function.

2. The block following the &getdata function (consisting of HTML and further GDIdb functions enclosed in curly braces { } ) is repeated for each row of the recordset (table of data) that the SQL query returns.

If the function is supplied with an (optional) second argument n, it will only loop for the first n rows in the recordset.  If no second argument is supplied, or n is greater than the number of rows in the recordset, the function will loop through all rows in the dataset. If zero rows of data are returned by the SQL statement, the block of code following the & getdata function will not be executed.

The & getdata function can be followed by a &else function to execute code in the situation where the dataset returned by  the  SQL statement  is empty. If the function returns 1 or more rows of data, the block of code following the &else function will not be executed.

Note: This function is equivalent to the  &sql function and the &foreachrow function combined. (Both of which it depreciates)

Example:

# Use globaldata ODBC DSN

&datasource(“DSN=globaldata”)

# Print out the contents of 1st 5 rows of data from the categoryname column

# of the dataset

&getdata (“SELECT * FROM Categories",5)

{

<H3>Category=?categoryname?</H3>

}

# if the &getdata function fails to find any data, include a sorry

# message in the HTML

&else

{

<H3>Sorry! Table “categories” contains no data!</H3>

}


&foreachrow(n)

The &foreachrow function allows a block to be automatically repeated for each row of the dataset returned by a previous &sql function. The block to be repeated must be enclosed by opening and closing curly braces { } and may consist of HTML and further GDIdb functions.

If the function is supplied with an (optional) argument n, it will only loop for the first n rows in the recordset. A subsequent &foreachrow function will start where the previous one left off, allowing you to use this feature to spread the data from a large table across multiple HTML documents.

If no argument is supplied, or n is greater than the number of rows in the recordset,  the function will loop through all rows in the dataset. If zero rows of data are returned by the &sql function, the block of code following the &foreachrow function will not be executed.

The &foreachrow function can be followed by a &else function to execute code in the situation where the dataset returned by the &sql function is empty.  If the &sql function returns 1 or more rows of data, the block of code following the &else function will not be executed.

Note: This function is depreciated by the newer &getdata function.

Example:

# Use globaldata ODBC DSN

&datasource(“DSN=globaldata”)

# Get all data from table “categories” from globaldata ODBC DSN

&sql (“SELECT * FROM Categories")

{

# Print out the contents of 1st 5 rows of data from the categoryname column

# of the dataset

&foreachrow(5)

{

<H3>Category=?categoryname?</H3>

}

# if the &foreachrow function fails to find any data, include a sorry

# message in the HTML

&else

{

<H3>Sorry! Table “categories” contains no data!</H3>

}

}


&if()
&if(expression)

The &if function allows a block to be executed in the event that the argument to the &if function returns true. The block to be executed must be enclosed by opening and closing curly braces { } and may consist of HTML and further GDIdb functions.

The &if function can be followed by an &else function to execute code in the instance where the argument to the &if function returns false. The argument to the function can be an arithmetic/Boolean expression, and should return a Boolean result, although any non-zero value will be treated as TRUE.

Example:

# Use globaldata ODBC DSN

&datasource(“DSN=globaldata”)

# Get all data from table “categories” from globaldata ODBC DSN

&sql (“SELECT * FROM Categories")

{

# The following block is only run if the dataset returned from &sql is contains data

&if (?recordsetsize?>0)

{

<H1>The database table “categories” does contain data. </H1>

}

}


&loop(expression )

The &loop function allows a block to be repeatedly executed in the event that the argument to the &loop function returns true. The block to be executed must be enclosed by opening and closing curly braces { } and may consist of HTML and further GDIdb functions. The argument to the function can be an arithmetic/Boolean expression, and should return a Boolean result, although any non-zero value will be treated as TRUE.

Example:

# Open HTML file for writing

&html(“index.html”)

{

# declare user variable “count” and set it to a value of 10

&defvar(?count?)

&assign(?count?,10)

# loop until count is zero. This function will loop 10 times

&loop (?count?>0)

{

# write the current value of count to the HTML file

?count?

# Decrement count

&dec(?count?)

}

}


&else

The &else function allows a block to be executed in the event that the previous &if function’s argument evaluated false, or in the event that a previous &foreachrow  or &getdata function failed to find any data.

Example:

# Use globaldata ODBC DSN

&datasource(“DSN=globaldata”)

# Get all data from table “categories” from globaldata ODBC DSN

&sql (“SELECT * FROM Categories")

{

# The following block is only run if the dataset returned from &sql contains data

&if (?recordsetsize?>0)

{

<H1>The database table “categories” does contain data. </H1>

}

# The following block is only run if the dataset returned from &sql does not  contain data

&else

{

<H1>The database table “categories” is empty.</H1>

}

}


&getrow(n)

The &getrow function retrieves row n of the recordset.  The argument to the function can be an arithmetic expression. This function must be preceded by a call to &sql to generate a dataset. Care must be taken not to call &getrow when there is no corresponding row of data available in the dataset, as it will cause an error.

Example:

# Get all data from table “categories” from globaldata ODBC DSN

&sql (“SELECT * FROM Categories")

{

&getrow(2)

# any further datasource variables used will return the contents of row 2

}


&defvar(variablename)
&defvar(?variablename?)

The &defvar function declares a user-defined variable. All user-defined variables must be declared with &defvar before they are referenced in a script file. On creation, user-defined variables contain an empty text string. Multiple variables can be declared using the same defvar function by separating the list of  variable names with a comma. If the variable is supplied with an index, the variable is created as an array sized to the index value, e.g:

&defvar(?myarray[10]?)

creates a variable array with 10 elements.

GDIdb variables are not typed, the same variable may be used to hold numeric or text values.

All user variables have global scope, that is they may be referenced anywhere in the script file, including subroutines and blocks of code other than where they were declared.

Please see the section on Variable Arrays for a more in-depth treatment of how GDIdb handles variables and arrays.

Example:

&html(“index.html”)

{

# declare variable myvar

&defvar(?myvar?)

# assign the value 5 to myvar

&assign(?myvar?,5)

# write the contents of myvar (5) to the HTML file

?myvar?

}


&assign(variablename,expression)
&assign(?variablename?,expression..)

The &assign function is used to assign the results of an arithmetic/Boolean expression or a text string expression to a user-defined variable. Before the variable may be assigned to, it must have been declared using the &defvar function.

GDIdb will attempt to evaluate the expression passed to the assign function as an  arithmetic/Boolean expression  unless the expression is enclosed in double quotes in which case it is evaluated as a text string expression

Note that ? enclosed variables embedded in arithmetic/Boolean expressions and text strings will have the variable value substituted. If you wish to include a ? or “ character in a text string,  it must be preceded by a \ character.

Notes:

1.  If you wish to assign a text string to a variable, the text string must be enclosed in double quotes even if the source text is in a variable.

e.g.

&assign(?var1?,"text message")

&assign(?var2?,"?var1?")

If you do not include the double quotes in the second &assign function, the assign function will attempt to evaluate the contents of ?var1? as an arithmetic/Boolean expression, which will result in an error.

2.  &assign(?var?,1+2/3)

is the GDIdb equivalent of the BASIC statement

LET var=1+2/3

3.  Multiple assignments can be made with a single &assign function by passing the assign function a list of variable-value pairs, e.g:

&assign(?var1?,28 , ?var2? , "Test Message" , ?var3? , 34)

-assigns values to variables ?var1?,?var2? and ?var3?

Examples:

&html(“index.html”)

{

# declare variable myvar

&defvar(?myvar?)

# assign the value 5 to myvar

&assign(?myvar?,5)

# insert the value held in myvar (5) into the HTML file

?myvar?

# add the value 10 to myvar, and assign this value back to myvar

&assign(?myvar?,?myvar?+10)

# insert the value held in myvar (15) into the HTML file

?myvar?

# create a text message using the contents of myvar

&assign(?myvar?,”Five plus Ten=?myvar?”)

# insert the value held in myvar ( “Five plus Ten=15”) into the HTML file

?myvar?

}


&defsub(subroutinename)
&defsub(“subroutinename”)

The &defsub function is used to declare a block of code as a subroutine. The code itself must be enclosed in curly braces { } and must follow the &defsub() function. The argument  to the function is used as the subroutine name, and must be a text string expression

You can declare a subroutine anywhere within a script file, the code is only executed when:

•	It is invoked by a &gosub() function.

•	It is invoked as a function by placing the subroutine name in your script, preceded with a & character.

If the subroutine is invoked as a function, you may pass numeric or string expression arguments to it in a similar fashion to other GDIdb script functions.  When the subroutine is run, GDIdb creates an array of user variables (named ?argv?) from any arguments passed.  This array may be used in exactly the same way as user-defined variables, although it must be remembered that the variables only exist for the scope of the subroutine block- GDIdb automatically deletes them on return from the subroutine.

Note: You may require local variables in your subroutine, for example if you wish to use recursion. Although GDIdb does not support true local variables, you can achieve a similar effect by creating all of the variables that you require to be local at the start of the subroutine, and then deleting them at the end of the subroutine, just before the closing curly brace character. See help topics on &defvar and &delete functions for further information.

Example:

# The following  code demonstrates options for executing subroutines

&html(“index.html”)

{

# call subroutine1 using &gosub

&gosub(“mysub1”)

# call subroutine1 as a function

&mysub1

# call subroutine 2, passing 2 text strings as arguments

&mysub2("Hello","there")

}

&defsub(“mysub1”)

{

&print("Hello from subroutine 1")

}

&defsub(“mysub2”)

{

&print("?argv[1]? ?argv[2]? from subroutine 2")

}


&gosub(subroutinename)
&gosub(“subroutinename”)

The &gosub function is used to execute a block of code as a subroutine. The code itself must be declared using the  &defsub function somewhere within the script file. The argument  to the function must be a text string expression

Note: &gosub is largely obsolete, and is included primarily for backwards compatibility. Subroutines declared using the &defsub function can be more conveniently executed by placing a & character in front of the subroutine name. See  &defsub for more details.

Example:

# The following  code will write  <H1>Hello!</H1> twice to index.html

&html(“index.html”)

{

&gosub(“hello”)

&gosub(“hello”)

}

&defsub(“hello”)

{

<H1>Hello!</H1>

}


&inc(?variablename?)

The &inc function will increment the numeric value of the variable passed as an argument by one, and re-assign the result to that variable.

Example:

&html(“index.html”)

{

&defvar(?myvar?)

&assign(?myvar?,5)

# print the contents of myvar (5) to the HTML file

?myvar?

&inc(?myvar?)

# print the contents of myvar (6) to the HTML file

?myvar?

}


&dec(?variablename?)

The &dec function will decrement the numeric value of the variable passed as an argument by one, and re-assign the result to that variable.

Example:

&html(“index.html”)

{

&defvar(?myvar?)

&assign(?myvar?,5)

# print the contents of myvar (5) to the HTML file

?myvar?

&dec(?myvar?)

# print the contents of myvar (4) to the HTML file

?myvar?

}


&datawrite("filename",?variablename?)

The &datawrite function is used to write the contents of a variable directly to a file. If used with a datasource variable, a binary transfer is made, allowing binary datasource fields (i.e. image files) to be turned directly into files. Any files created by the &datawrite function are stored in the local HTML directory. (This directory is configurable in System Configuration under the Settings menu. The maximum size of the datasource field is not restricted to the 64Kb limit that normally applies to datasource variables, the practical upper limit of the file size will normally be dictated by the amount of disk space available to GDIdb. The filename must be passed as the first argument to the function, and must be a text string expression, the second argument to the function is the datasource variable containing the data.

The file path can consist of a filename and directory path, if you are writing data files to sub-directories you must ensure that the sub-directories exist, both on your web server and in your local HTML directory. The file path given must be relative  to the root HTML directory.  The local root HTML directory and the Web Server root HTML directory can both be configured in the system configuration dialog. (under the Settings menu)

GDIdb keeps a list of filenames created by the &datawrite and &html functions, all files on this list are transferred to the web server on publish and Upload to Web Server commands. You may view this list, and edit the files themselves by selecting Edit HTML. (under the Edit menu)

Notes:

1. You cannot use a file path that attempts to create a file in a directory above the HTML root directory, or a file path that is not relative to the local html root directory.  E.g. both of the following file paths are illegal: "C:\html\index.html" and "/mydir/index.html"

2. Directories in the file path may be separated with forward slashes or backward slashes- remember that when using backward slashes in a string expression that you will need two backward slashes: e.g. "mydir\\index.html"

3. Some database programs (such as Microsoft Access) store binary files as packaged OLE objects. If this is the case with your database software, the following example is unlikely to work.

Example:

# Use globaldata ODBC DSN

&datasource(“DSN=globaldata”)

&html(“index.html”)

{

&sql (“SELECT * FROM Categories")

{

# extract binary datasource field ?imagefield?

# and write to file

&datawrite("mydir/picture1.jpg",?imagefield?)

# include image on web page

<IMG SRC="picture1.jpg">

}

}


&dataread(?variablename? ,"filename")

The &dataread function will read the contents of the text file whose name is passed as the second argument into the variable passed as the first argument. Only text files may be used with this function, as user variables cannot contain binary data.  If only a filename is provided, &dataread will include the contents of the file in the currently opened HTML file.  The second  argument  to the function must be a text string expression

Note: The file path may be an absolute path, or may be relative to the GDIdb program directory.

Example:

&html(“htmlfile1.html”)

{

# include the contents of "mytext.txt" into the HTML file

&dataread("mytext.txt")

# the following would have the same effect:

&defvar(?var1?)

&dataread(?var1?,"mytext.txt")

?var1?

}


&break

The break function is used to terminate execution of the smallest enclosing &loop, &foreachrow, &do, &while, &for or &getdata block. The &break function will cause script execution to resume after the end of the &loop, &foreachrow, &do, &while, &for or &getdata block in which it was encountered.

Example:

# The following example will write all the numbers between 9 and 1

# to  htmlfile1.html

&html(“htmlfile1.html”)

{

# create a count variable, & initialize to 10

&defvar(?var1?)

&assign(?var1?,10)

# this loop statement would normally execute indefinitely,

# as it will always evaluate true

&loop(1)

{

&dec(?var1?)

# check to see if variable has been decrement to zero

&if(?var1?==0)

{

# break loop if variable has been decremented to zero

&break

}

?var1?

}

}


&continue

The &continue function will cause the script to start executing back at the start of the smallest enclosing &loop, &foreachrow, &do, &while, &for or &getdata block.  The script between the &continue function and the block closing brace will not be executed.

Example:

# The following example will write all the numbers between 9 and 5

# to  htmlfile1.html

&html(“htmlfile1.html”)

{

# create a count variable, & initialize to 10

&defvar(?var1?)

&assign(?var1?,10)

# the following loop will loop 10 times

&loop(?var1?!=0)

{

&dec(?var1?)

# check to see if count variable ?var1? is less than 5

&if(?var1?<5)

{

# jump back to start of loop if ?var1? is less than 5

&continue

}

?var1?

}

}


&toupper
&toupper(?varname?,"string")

The &toupper function will convert all of the characters in the text string expression passed as the second argument into upper case. The resulting text string is assigned to the variable passed as the first argument to the function.

Example:

&html(“htmlfile1.html”)

{

&defvar(?var1?)

&?assign(?var1?,"hello")

&toupper(?var1?,"?var1?")

# variable ?var1? will now contain the text "HELLO"

}


&tolower
&tolower(?varname?,"string")

The &tolower function will convert all of the characters in the text string expression passed as the second argument into lower case. The resulting text string is assigned to the variable passed as the first argument to the function.

Example:

&html(“htmlfile1.html”)

{

&defvar(?var1?)

&?assign(?var1?,"HELLO")

&tolower(?var1?,"?var1?")

# variable ?var1? will now contain the text "hello"

}


&strcmp
&strcmp(?varname?,"string",COMP,"string",..)

The &strcmp function is used to compare text string expressions, the result of the comparison is assigned to the variable passed as the first argument. The &strcmp function will typically precede an &if function, allowing conditional script execution on the basis of the string comparison results.

The &strcmp function makes a comparison of pairs of string expressions, and assigns the  combined Boolean result to variable ?varname?.

Each string in the comparison must  be a text string expression,

and COMP is the code indicating the comparison to be made. Valid codes are:

COMP	String Comparison result
eq	True if string1 is the same as string2
ne	True if string1 is different to  string2
lt	True if string1 is less than string2 (lexicographical)
gt	True if string1 is greater than string2 (lexicographical)
in	True if string1 exists anywhere within string2

In addition, if you require that the comparison made between the two strings is not case-sensitive, append .nc onto the end of the code, e.g:

&strcmp(?var1?,"THERE",in,"Hello there Fred!")	-Evaluates false

&strcmp(?var1?,"THERE",in.nc,"Hello there Fred!")	-Evaluates true

Multiple string comparisons can be made using a single &strcmp function, the results (string expressions evaluated left to right) are combined using a combine code CC. Valid codes are:

CC	Logical Combination result
AND	True if comparison 1 and comparison 2 are both true.
OR	True if either comparison 1 or comparison 2 are true.

Example:

&html(“htmlfile1.html”)

{

&defvar(?var1?,?var2?,?var3?)

&assign(?var1?,"John",?var2?,"Fred")

# compare variables ?var1? and ?var2? with the text strings

# "John" and "Fred" respectively. Assign the Boolean

# result to ?var3?

&strcmp(?var3?,"?var1?",eq,"John",AND, "?var2?",eq,"Fred")

&if(?var3?)

{

<H1>Variable var1 contains the name  "John",

and variable var2 contains the name "Fred</H1>

}

}


&strin
&strin(?varname?,"string1","string2")

The &strin function searches for substring string1 within string2, and assigns the position of the substring within string2 to variable ?varname?. If the string is not found, ?varname? is assigned the value -1

Arguments two and three must be  text string expressions.

Example:

&html(“htmlfile1.html”)

{

&defvar(?var1?,?var2?)

&?assign(?var1?, "Hello there Fred!")

&strin(?var2?,"there","?var1?")

&if(?var2?!=-1)

{

<H1>Variable var1 contains the word "there" at position ?var2?</H1>

}

&else

{

<H1>Text string was not found!</H1>

}

}


&midstr
&midstr(?varname?,"string",n1,n2)

The &midstr function extracts the text substring from the string expression (passed as the second argument to the function) starting at position n1 and of length n2. This substring is assigned to the variable passed as the first argument to the function.

Example:

&html(“htmlfile1.html”)

{

&defvar(?var1?)

&?assign(?var1?, "Hello there Fred!")

# ?var1? contains "Hello there fred"

&midstr(?var1?,"?var1?",12,4)

# ?var1? now contains "fred"

}


&strlen
&strlen(?varname?,"string")

The &strlen function calculates the length of the  text string expression. passed as the second argument, and assigns this value to the variable passed as the first argument to the function.

Example:

&html(“htmlfile1.html”)

{

&defvar(?var1?,?var2?)

&?assign(?var1?, "Hello there Fred!")

&strlen(?var2?,"?var1?")

# ?var2? now contains the value 17

}


&strtrim
&strtrim(?varname?,"string")

The &strtrim function will remove leading and trailing whitespace characters from the text string expression passed as the second argument to the function. After processing, the string is assigned to the variable passed as the first argument to the function.

Example:

&html(“htmlfile1.html”)

{

&defvar(?var1?)

&?assign(?var1?, "          Hello there Fred!             ")

# ?var1? contains the text string "          Hello there Fred!             "

&strtrim(?var1?,"?var1?")

# ?var1? now contains the text string  "Hello there Fred!"

}


&return

The &return function is used to return directly from a subroutine. You do not need to place a &return function at the end of a subroutine. (Return from a subroutine after the closing curly brace character is automatic)

The return function can also be used to terminate execution of a script- if it is encountered outside of a subroutine, execution of the script will halt without error at that point.

Example:

&defsub(“mysubroutine”)

{

&if(?var1?==6)

{

&return

}

&html("file?var1?.html")

{

<HTML>

<P>This file is only written if var1 does not equal 6

</HTML>

}

}


&die

The &die function is used to force the script to halt. This function may be useful if for any reason you wish to terminate the script with an error state, thus preventing an FTP upload of any files generated by a publish or auto-publish operation. A message passed as an argument to the function will be written to the log file as the exit message if logging is enabled. If you wish your message to show up in the log file with the error filter on, you must precede your message with "ERROR- "

Example:

&if(?recordsetsize?==0)

{

&die("ERROR- script halted because the database is empty!")

}

&html("index.html")

{

<HTML>

<P>This file is only written if recordsetsize>0

</HTML>

}


&ftoint
&ftoint(?varname?,"string")

The &ftoint function is used to evaluate the text in the  text string expression passed as a second argument as a floating-point number. This number is converted to an integer and assigned to the variable passed as the first argument. This function is useful if you wish to do numerical calculations on data from a floating-point database field.

Example:

&html("index.html")

{

&defvar(?var1?,?var2?)

&assign(?var1?,"346.826e2")

&ftoint(?var2?,"?var1?")

# ?var2? will now contain 34683

?var2?

}


&ascii
&ascii(?varname?,"string",n)

The &ascii function assigns the ASCII code of the character at index n in the text string expression passed as a second argument to the variable passed as the first argument. The index is zero-based, e.g. index of 0 will evaluate the first character in the string. If a third argument is not supplied, an index of zero is assumed.

Example:

&html("index.html")

{

&defvar(?var1?,?var2?)

&assign(?var1?,"abc")

&ascii(?var2?,"?var1?",1)

# ?var2? will now contain 98 (the ascii code for 'b')

?var2?

}


for(?variablename?,start,test, increment)
&for(?variablename?,start,test,increment)

The &for function provides a more comprehensive version of the &repeat function, and allows a block to be repeated a specified number of times. The block to be executed must be enclosed by opening and closing curly braces { } and may consist of HTML and further GDIdb functions. The arguments to the function must be as follows:

Argument	Function
1	The name of the  variable used as an index count.
2	The initial value of ?variablename?
3	The test expression- the loop will be repeated whilst this evaluates true
4	The loop increment, the result of this expression is added to ?variablename? on each iteration of the loop.

Arguments 2,3 & 4 must be arithmetic/Boolean expressions.

Example:

# Open HTML file for writing

&html(“index.html”)

{

# declare user variable “count”

&defvar(?count?)

# loop until count is zero. This function will loop 5 times

&for(?count?,0,?count?<10,2)

{

# write the current value of count to the HTML file

?count?

}

}


&do

The &do function allows a block to be repeatedly executed in the event that the argument to the &while function following the &do block returns true. The block to be executed must be enclosed by opening and closing curly braces { } and may consist of HTML and further GDIdb functions. The argument to the & while function can be an arithmetic/Boolean expression, and should return a Boolean result, although any non-zero value will be treated as TRUE.

Example:

# Open HTML file for writing

&html(“index.html”)

{

# declare user variable “count” and set it to a value of 10

&defvar(?count?)

&assign(?count?,10)

# loop until count is zero. This function will loop 10 times

&do

{

# write the current value of count to the HTML file

?count?

# Decrement count

&dec(?count?)

}

&while (?count?>0)

}


&while(expression)
&while

The &while function, can be used in two ways:

1. As part of a &do loop

2. Without a corresponding &do function, the &while function operates in the same way as the &loop function.


&delete()
&delete(?varname1?,?varname2?,..)

The &delete function is the opposite of the &defvar function, and will remove a user variable.

Please see the section on Variable Arrays for a more in-depth treatment of how GDIdb handles variables and arrays.

Note: Any variables still in existence at the end of the script are automatically deleted.

Example:

# The delete function can be used to provide variables that are local to subroutines, e.g

&html("index.html")

{

&defvar(?var1?)

&assign(?var1?,132)

?var1?

# the above reference to ?var1? will insert 132 into the html file

&mysub

?var1?

# the above reference to ?var1? will still insert 132 into the html file

}

&defsub("mysub")

{

&html("file1.html")

{

# create a new variable called ?var1?- if ?var1? already exists,

# this &defvar will "mask" it

&defvar(?var1?)

&assign(?var1?,"abc")

?var1?

# the above reference to ?var1? will insert "abc" into the html file

&delete(?var1?)

# any further references to ?var1? will now fail, unless ?var1?

# was previously defined, in which case it will revert to it's

# previous value.

}

}


&arraydelete(variablename)
&arraydelete(?variablename?)

The &arraydelete is similar to in operation to the &delete function, and will delete all elements of the user-defined variable array passed as an argument.

Please see the section on Variable Arrays for a more in-depth treatment of how GDIdb handles arrays.

Note: Any arrays still in existence at the end of the script are automatically deleted

Example:

&html(“index.html”)

{

# declare array

&defvar(?myvar[10]?)

&assign(?myvar[4]?,"Hello!")

# referencing ?myvar[4]? will insert "Hello" in the html file

?myvar[4]?

&arraydelete(?myvar?)

# Any references to array ?myvar? will now cause an error

}


&arraysize(variablename,arrayname)
&arraysize(?variablename?,?arrayname?)

The &arraysize will calculate the number of elements in the array passed as the second argument and assign this number to  the variable passed as the first argument. If the variable array does not exist, a value of zero is assigned.

Please see the section on Variable Arrays for a more in-depth treatment of how GDIdb handles arrays.

Example:

&html(“index.html”)

{

# declare array

&defvar(?myvar[10]?)

# declare variable

&defvar(?asize?)

&assign(?myvar[4]?,"Hello!")

# referencing ?myvar[4]? will insert "Hello" in the html file

?myvar[4]?

&arraysize(?asize?,?myvar?)

# the following reference to ?asize? will insert '10' into the html file

?asize?

&arraydelete(?myvar?)

&arraysize(?asize?,?myvar?)

# the following reference to ?asize? will insert '0' into the html file

?asize?

}


&msgbox(?variablename?,"text",buttonstyle,iconstyle)

The &msgbox function opens a dialog box containing a user-defined message "text" which must be a text string expression. If a user variable is passed as the first argument, a buttonstyle argument must also be included- when the user closes the dialog box by clicking a button, this variable will contain a code  indicating which button was clicked.  An icon may also be included on the dialog box, the code for the required icon is passed as the final  argument.

Note: Script execution will halt until the user dismisses the dialog. For this reason, do not use the &msgbox function if you intend to run the script using auto-publish, unless you intend it to halt operation of the program.

buttonstyle code	meaning
ok	Single O.K. Button (The default)
okcancel	O.K. and Cancel Buttons
yesno	Yes and No Buttons
yesnocancel	Yes, No and Cancel Buttons
iconstyle code	meaning
iconexclamation	Exclamation icon
iconwarning	Warning icon
iconinformation	Information icon
iconquestion	Question mark icon
iconerror	Error icon

Return codes assigned to ?variablename? are:

Button	Code
Yes	6
No	7
OK	1
Cancel	2

Example:

# messagebox with no icon and a single (O.K.) button

&msgbox("Hello")

# messagebox with warning icon and a single (O.K.) button

& msgbox("Hello",iconwarning)

&defvar(?returnval?)

# messagebox with information icon and yes/no/cancel buttons

& msgbox(?returnval?,"Hello",yesnocancel,iconinformation)

# variable ?returnval? will now contain a code indicating

# which button was pressed

&if(?retval?==6)

{

&msgbox("You pressed the Yes button!")

}


&input(variablename,message)
&input(?variablename?,"message")

The &input function will open a dialog box allowing the user to enter a text string. If the user presses the OK button, the text string is assigned to the variable passed as the first argument to the function, if the user presses the Cancel button the existing contents of the variable are left unchanged. An optional string expression may be passed as a second argument- this will be displayed on the dialog box.

Note: Script execution will halt until the user presses the OK or Cancel button. For this reason, do not use the &input function if you intend to run the script using auto-publish!

Example:

# this simple calculator program retrieves an arithmetic

# expression from the user, evaluates it using the

# assign function, & displays the answer in a message box

&defvar(?var1?)

&input(?var1?,"Enter arithmetic expression")

&assign(?var1?,?var1?)

&msgbox("Result=?var1?")


&print(message)

The &print  function displays the string expression passed as an argument in the program status window. If the function is not given an argument, it will print a blank line.

Example:

&print "Starting to write file index.html")

&html(“index.html”)

{

}


&log(message)

The &log function writes the string expression passed as an argument to the system log. The text will be written even if generate system log is not enabled under the settings menu. The log entry will be time and date stamped.

Example:

&log("Starting to write file index.html")

&html(“index.html”)

{

}


&cls

The &cls function clears the status display window.

Example:

# clear status window

&cls

# print message on first line of status window

&print("Starting Script execution")


&repeat
&repeat(?varname?,n)

The &repeat function provides a simplified version of the &for function. A repeat count is passed as an argument to the function, an (optional) variable passed as the first argument to the function will have the current repeat count assigned to it on each iteration of the loop.

Example:

# Create a graph of X squared on the web page using plus signs

&html("index.html")

{

&defvar(?count?)

<H1>Graph showing the function of X^2</H1>

<FONT SIZE=1>

&for(?count?,0,?count?<10,1)

{

<NOBR>&repeat(?count?*?count?){+}</NOBR><BR>

}

</FONT>

}


&chr
&chr(?variablename?,n)

The &chr function assigns the variable passed as the first argument the character whose ASCII code is passed as the second argument.

Example:

&html("index.html")

{

&defvar(?char?)

&chr(?char?,65)

# variable ?char? now contains the character 'A'

?char?

}


&dec2hex
&dec2hex(?variablename?,n,code)

The &dec2hex function will convert the number passed as the second argument into a text string representing the number in hexadecimal. An (optional) code may be passed as a third argument, to pack the text string with leading zeros.

code	digits (min)
byte	2
word	4
dword	8

Example:

&html("index.html")

{

&defvar(?hexnum?)

&dec2hex(?hexnum?,65535)

# ?hexnum? now contains the text 'FFFF'

?hexnum?

&dec2hex(?hexnum?,3,byte)

# ?hexnum? now contains the text '03'

?hexnum?

}


&hex2dec
&hex2dec(?variablename?,hex)

The &hex2dec function will attempt to evaluate the text string expression passed as the second argument to the function as a hexadecimal number. The resulting decimal number is assigned to the variable passed as the first argument.

Example:

&html("index.html")

{

&defvar(?num?)

&hex2dec(?num?,"FFFF")

# ?num? now contains the numeric value 65535

?num?

}


&exec
&exec("commandline")

The &exec function allows a DOS/Windows command-line argument to be executed, allowing DOS batch files or other software to be run from a GDIdb script.

Example:

# run the Windows Clock program

&exec("clock.exe")


&sleep
&sleep(n)

The &sleep function will halt execution of the script file for n milliseconds.

Example:

# Pause for 1 second

&sleep(1000)


User-defined Variable Arrays

GDIdb supports user-defined variable arrays as an extension of user-defined variables. When GDIdb creates a variable using the &defvar function, an instance of that variable is added to GDIdb's internal variable list, which contains the names of all of the variables that have been defined at that point in the script. If the &defvar function is used to declare a variable that already exists, a new variable of that name is added to the end of the GDIdb variable list, and any references to the variable will access the new variable. The original variable of that name still exists within the GDIdb variable list however, and can be accessed in a similar fashion to nested database variables, e.g:

?variablename?	Refers to the last-defined variable of this name

?variablename[-1]	Refers to the previously-defined  variable of this name.

?variablename[0]? is the same as ?variablename?

In addition, a positive (1 based) index can be used. A positive index will cause GDIdb to search from the other end of the variable list so that:

?variablename[1]?	Refers to the first defined instance of ?variablename?

?variablename[2]?	Refers to the second defined instance of ?variablename?

To assist with the creation of arrays, the &defvar function allows the creation of an array of any length. It is important to realize though that arrays and normal variables are actually the same thing, hence:

&defvar(?myarray[100]?)

is exactly  the same as the following bit of code:

&defvar(?count?)

&for(?count?,0,?count?<100,1)

{

# execute the &defvar function 100 times

&defvar(?myarray?)

}

and:

&arraydelete(?myarray?)

is exactly  the same as the following bit of code:

&defvar(?count?,?size?)

# calculate the size of the array

&arraysize(?size?,?myarray?)

&for(?count?,0,?count?<?size?,1)

{

# execute the &delete function 100 times

&delete(?myarray?)

}

The size of an array may be changed at any time, use &delete to delete a single element from the array, and &defvar to add a single item to the end of the array, e.g:

# extract data from a database, and save in an array, which grows dynamically

# for each record of database data

&getdata("SELECT * FROM Sheet")

{

# for each row in the database table, create a new ?myarray? variable

&defvar(?myarray?)

# and assign it the contents of the database "product" field

&assign(?myarray?,"?product?")

}

# get the size of the array

&defvar(?asize?,?count?)

&arraysize(?asize?,?myarray?)

&html("index.html")

{

# print the contents of each of the array variables to index.html"

&for(?count?,1,?count?<=?asize?,1)

{

?myarray[?count?]?

}

}

# even though the array was created using multiple &defvar functions, it

# is easier to delete it using the &arraydelete function

&arraydelete(?myarray?)


Datasource Variables

Datasource variables allow data extracted from your datasource to be merged with your HTML, and are automatically created by GDIdb &sql and &getdata functions. The name of a datasource variable is taken directly from the name of the column of data in the database/spreadsheet table whose data it will contain. Question marks define the start and end of a datasource variable name. (e.g. ?columname? )

Datasource variables may be mixed with HTML in your script file- when the script is run GDIdb will insert the datasource data from the column whose name matches the datasource variable name.

The row of data returned in the datasource variables can be set using the &getrow and &nextrow functions, although (more conveniently) the &foreachrow and &getdata functions allow you to iterate through each row of data automatically.

Nested &sql and &getdata functions each mask the previous  function’s data, in order to access this a relative index must be added to the variable. This is a number enclosed in square brackets[] which must appear before the closing ‘?’ character. ( e.g. ?columname[-5]? ) The index value must be zero or less, and indicates the depth of nested &sql functions that separate the variable from it’s defining &sql or &getdata function. (e.g. ?columname[-1]? will return ?columname? from the previous function, ?columname[0]?  is equivalent to ?columname?  )

In addition, a (1 based) positive index may be supplied to a datasource variable, the data returned will then be relative to the first rather than the last &sql/&getdata function as follows:

?columname[1]?	The contents of ?columname? from the top-level  &sql/&getdata function.

?columname[2]?	The contents of ?columname? from the &sql/&getdata function the next level down.

In addition to the variable names defined by the column names in the datasource, there are two datasource system variables that you can use in your script. These are:

?recordsetsize? this variable returns the number of rows of data created by the &sql and &getdata functions.

?rownumber? this variable returns the actual row of datasource data currently being processed. This variable will increment with each loop of a &foreachrow  or & getdata function.

Note:

Database variables are read-only, and can not be re-assigned.


System Variables

GDIdb has system variables which can be used to access the system time and date information. These are as follows:

VARIABLE	CONTAINS
?gdidbtime?	The current time in the format hh:mm:ss
?gdidbtime.h?	The current time. (Hours only)
?gdidbtime.m?	The current time. (Minutes only)
?gdidbtime.s?	The current time. (Seconds only)
?gdidbdate?	The current date in the format mm/dd/yy.
?gdidbdate.d?	The current day of the month as a number.
?gdidbdate.dn?	The name of the current day of the month .
?gdidbdate.m?	The current month as a number.
?gdidbdate.mn?	The name of the current month .
?gdidbdate.y?	The current year as a number.


User-defined Variables

GDIdb supports user-defined variables, these must be declared using the &defvar  function before they can be used. The &assign function can be used to set the value of user-defined variables. Once created, user-defined variables may be used in a similar way as datasource and system variables, any point where the variable name appears in a script  enclosed within ? characters, GDIdb will substitute the actual variable value. Unlike system and datasource variables however, it is possible to assign a new value to a user variable using the &assign function.

User-defined variables are not typed, and may be used to hold text and numeric values, numeric values are held as type long int, this means integer values only are allowed and the value must lie between

 –2,147,483,648 and 2,147,483,647


Arithmetic and Boolean Expressions

GDIdb Scripter supports basic arithmetic and Boolean expressions, these may be used whenever a function argument expects a numeric value. An arithmetic/Boolean expression may consist of a series of numbers, variables and operators, the allowable operators are:

+ Addition

- Subtraction

/ Division

* Multiplication

( ) Brackets may be used to force evaluation order

== test for equality

!= test for inequality

< test for less than

<= test for less than or equal to

> test for greater than

>= test for greater than or equal to

& Boolean AND

|  Boolean OR

Operator precedence (highest at the top) is:

( )

* /

+ -

< <= > >=  == != & |

Expressions are evaluated left to right.

The return value from a Boolean operator is 1 if true, and 0 if false.

Numbers are of type long int, this means that they are integer and lie between –2,147,483,648 and 2,147,483,647

See help topics on the &assign function for details on how to assign the results of an arithmetic/Boolean expression to a variable.

Example:

(2+6)/4	Returns 2

(2+3)>1	Returns 1 (true)

(4*5)>500	Returns 0 (false)


Text String Expressions

Many Script functions take string expressions as their arguments. A text string expression consists of "" enclosed text which may contain embedded variables. Any embedded variables will be translated when the string expression is evaluated.

Special characters:

The characters & \ ?  #  ( ) } and {  have special meanings. To include one of these characters in a text string expression, insert a \ character before the character, e.g. if you want a ? character to appear in your text,  you must put the sequence \? In your text string expression. To insert the \ character itself in your text, use the sequence \\ in your text string expression.

Note:

If you pass a text string to a function using a variable, it must still be enclosed in double quote characters. Variables appearing without enclosing double-quotes are assumed to contain numeric values rather than text, if the variable contains text an error will be caused by GDIdb attempting to evaluate it as a numeric expression.

 Examples:

&defvar(?var1?,?var2?)

&assign(?var1?,"index.html")

&html("?var1?")

{

&assign(?var2?,"Writing to file ?var1?")

# Variable ?var2? contains the text "Writing to file index.html"

}


SQL

Structured Query Language is the standard language used to communicate with database software. GDIdb &sql and &getdata functions use SQL to query the chosen ODBC datasource for the data that will be included in the Web Site. SQL is a complex and powerful language, and a full treatment of it is outside the scope of this text, however a few useful SQL commands are:

1. To make the entire contents of a datasource table "Tablename" accessible to GDIdb: &sql(“SELECT * FROM Tablename”)

2. To retrieve all the records from datasource table “Tablename” where the value of ColumnName is 5: &sql(“SELECT * FROM Tablename WHERE Tablename.ColumnName=5”)

3. To retrieve all the records from one column called ColumnName from a datasource table called Tablename: &sql(“SELECT ColumnName FROM Tablename”)

4. To retrieve all the records from datasource table “Tablename” where the text in column ColumnName contains the word ‘television’: &sql(“SELECT * FROM Tablename WHERE Tablename.ColumnName LIKE ‘%television%’”)

Note: GDIdb uses ODBC SQL conventions, this means that (when embedded in a text string in a LIKE clause) the wildcard character for 1 or more of any characters is % not * and the wildcard character for 1 of any character is _ not ?

Furthermore,  if you are accessing your datasource using the ‘Jet’ database engine (used to access most databases apart from Oracle and SQL Server), the text string to match in the LIKE clause must be enclosed in ‘single quotes’ and not “double quotes”

(see above example)

Whilst your Script will work if you always use SELECT * to make all datasource columns available to your script, it may run faster if you just ask for the column names that you are actually going to access, particularly if there are many columns in the table.

Tip: If you have a copy of Microsoft Access, you don’t need to learn SQL. Simply construct a select query to extract the data you want. (using Access visual query design tools) Once you have a query that returns the data you wish to use from GDIdb, select View/SQL on the Access menu. The query you have designed will be displayed as a text SQL query, simply cut and paste this text and use it as the argument to a &sql or &getdata function in your GDIdb Script. If your SQL statement includes the wildcard pattern-matching characters ? or * , or text strings enclosed in double quotes “, remember to translate them to the ODBC SQL equivalents mentioned above.


ODBC

Open Data Base Connectivity is a system provided in Windows to allow a range of different Database applications to exchange data.  The setup program for GDIdb will install ODBC if you do not already have it on your computer. (click on My Computer - Control Panel where you should find an icon named ODBC)

GDIdb is supplied with the Microsoft data access pack, which installs the latest  version of ODBC, plus drivers for the following data sources: Microsoft Access, Excel, FoxPro, dBase, Paradox, SQL Server and Text files. If you wish to extract data from a database/spreadsheet that is not listed above, you will need to obtain and install a suitable ODBC driver before you can use GDIdb with your datasource.

GDIdb allows you to extract data directly from either a database/spreadsheet file,  or an ODBC Data Source Name. (DSN)  A DSN is simply a convenient way of storing all of the datasource connect information (file name, path, user I.D, connect password, database type etc) under a simple name.

If you want to create a new ODBC  DSN  from your database or spreadsheet, double-click on the ODBC icon and click “add” to add a user DSN. You will then be prompted  to select an ODBC driver appropriate for the datasource you are connecting to. ODBC as installed by GDIdb comes with ODBC drivers for Microsoft Access, Excel, FoxPro, Paradox, Text Files and SQL Server. If your datasource is not one of these you will need to obtain and install an appropriate driver from the vendor of your database software. Once you have selected the ODBC driver, you will be presented with a dialog in which you need to enter a datasource name. This will be the name GDIdb will use to access the datasource. Next you will need to attach the DSN to your database file or database server. Press the Select button,(in the Datasource group of buttons) browse for the datasource file, and click OK once you have it selected.

Note: GDIdb will not run at all if ODBC is not installed on your computer.


Steps to publishing your datasource

Follow these steps to publish your datasource on the WWW.

1. Create a GDIdb Script File. The simplest way of creating a script file is to run Script Wizard, (Under Edit on the GDIdb menu) which will automatically generate a basic Script file. After you have run script wizard, you can add html to the script file by selecting Open/Edit script from the Edit menu.

You can learn more about how to write script files from scratch in the on-line help, and also by looking at the example scripts provided. There are several example scripts stored in the GDIdb program folder which you can experiment with and examine for programming tips- these script files work with the Microsoft Access and Excel files included with the installation.

2. Test run your script. If everything is set up correctly, you should be able to select open/run script from the GDIdb menu and run your script. Any errors in the process of connecting to your datasource and generating the HTML for your web site will be reported by the software. If the script produces errors when run, select Edit/View Scripter List file to troubleshoot the script.

3. Preview Web Site. If no errors were reported, you may preview the web site generated by GDIdb by selecting Edit/Preview web site from the GDIdb menu.

4. Configure GDIdb. Select System Configuration on the Settings menu. Make certain that you have included all relevant information in the System Configuration dialog which opens up.

5. Upload to Web Server. Select Actions/Upload to Web Server from the menu to transfer the HTML generated by GDIdb to your Web Server.

6. Publish your Data. If you have entered the name of your script file in Settings/System Configuration/Publish Actions, you should now be able to complete the whole operation of running your script file and transferring the HTML generated bg GDIdb to your web server simply by clicking the publish button.

Once you have got this far, study help topics on Auto Publish for information on how to configure GDIdb for scheduled unattended operation.


Registering
Software Registration

GDIdb Software needs to be registered if you intend to use it beyond the 31 day evaluation period, after which it will require a registration key to run.

Please visit our web site on the following URL for details on how to obtain a registration key:

http://www.gd-ind.com/gdidb/

If you have obtained a key,  enter your registration name and key in the dialog which appears when GDIdb is started.

Details of the registration name and key can be found on GDIdb Help/About menu item.


GDIdb turns the data in your database/spreadsheet into HTML documents by executing a script file. This file is effectively a template describing the web site that will be constructed from your data, and consists of HTML and functions telling GDIdb what database data you wish to include. Run Script Wizard (under Edit) to create a basic script file.